﻿function NameOnFocus(field)
{
	if(field.value=='Họ tên'){ field.value = ''; field.className = 'adword-textbox2'}
}

function NameOnBlur(field)
{
	if(field.value==''){ field.value='Họ tên'; field.className = 'adword-textbox'}
}

function SearchOnFocus(field)
{
	if(field.value=='Từ khóa tìm kiếm'){ field.value = ''; }
}

function SearchOnBlur(field)
{
	if(field.value==''){ field.value='Từ khóa tìm kiếm';}
}

function EmailOnFocus(field)
{
	if(field.value=='Email'){ field.value = ''; field.className = 'function SearchOnFocus(field)
{
	if(field.value=='Từ khóa tìm kiếm'){ field.value = ''; }
}

function SearchOnBlur(field)
{
	if(field.value==''){ field.value='Từ khóa tìm kiếm';}
}
'}
}

function EmailOnBlur(field)
{
	if(field.value==''){ field.value='Email'; field.className = 'adword-textbox'}
}

function TitleOnFocus(field)
{
	if(field.value=='Tiêu đề'){ field.value = ''; field.className = 'adword-textbox2'}
}

function TitleOnBlur(field)
{
	if(field.value==''){ field.value='Tiêu đề'; field.className = 'adword-textbox'}
}

function ValidateCodeOnFocus(field)
{
	if(field.value=='Mã xác nhận'){ field.value = ''; field.className = 'adword-textbox2'}
}

function ValidateCodeOnBlur(field)
{
	if(field.value==''){ field.value='Mã xác nhận'; field.className = 'adword-textbox'}
}

function Trim(iStr)
{
	while (iStr.charCodeAt(0) <= 32)
	{
		iStr=iStr.substr(1);
	}

	while (iStr.charCodeAt(iStr.length - 1) <= 32)
	{
		iStr=iStr.substr(0, iStr.length - 1);
	}

	return iStr;
}
function FormatMoney(number) {

  
    var thousandsSeparator = ',';

    number = stripDollarSign(number);
    number = isNaN(number) || number == '' || number == null ? 0 : number;
    var numberStr = parseFloat(number).toFixed(2).toString();
    var numberFormatted = new Array(numberStr.slice(-3));   // this returns the decimal and cents
    numberStr = numberStr.substring(0, numberStr.length-3); // this removes the decimal and cents
    /*
     * Why is there an `unshift()` function, but no `shift()`?
     * Also, a `pop()` function would be handy here.
     */
    while (numberStr.length > 3) {
        numberFormatted.unshift(numberStr.slice(-3)); // this prepends the last three digits to `numberFormatted`
        numberFormatted.unshift(thousandsSeparator); // this prepends the thousandsSeparator to `numberFormatted`
        numberStr = numberStr.substring(0, numberStr.length-3);  // this removes the last three digits
    }
    numberFormatted.unshift(numberStr); // there are less than three digits in numberStr, so prepend them


    return numberFormatted.join('').replace(".00",""); // put it all together
}